package com.ljf.tijian.controller;

import com.ljf.tijian.dto.ApiResponse;
import com.ljf.tijian.dto.OrdersRequestDto;
import com.ljf.tijian.mapper.OrdersMapper;
import com.ljf.tijian.pojo.Orders;
import com.ljf.tijian.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    OrdersService ordersService;

    @RequestMapping("/queryOrderPage")
    public ApiResponse queryOrderPage(@RequestBody OrdersRequestDto ordersRequestDto){
//        System.out.println("进入订单查询");
//        System.out.println(ordersRequestDto.toString());

        return ordersService.queryOrdersByManyCondition(ordersRequestDto);
    }

    @RequestMapping("/updateordersstate")
    public ApiResponse updateordersstate(@RequestBody Orders orders){
//        System.out.println("进入订单查询");
//        System.out.println(ordersRequestDto.toString());
        System.out.println("更新订单状态的订单号为:"+orders.getOrderId());
        return ordersService.updateOrdersState(orders);
    }
}
